﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Usuarios.ascx.vb" Inherits="Content_Administracion_Adm_controls_Usuarios" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:HiddenField ID="hf_qryBusqueda" runat="server" Value="select * from vwUsers order by user_displayName" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<div class="titulos">
    <asp:Label ID="lbl_headerUsers" runat="server" Text="Administración de Usuarios"></asp:Label>
</div>

<div id="BusqUsuarios" class="divContent">
    <table class="tablaBusqueda">
        <tr>
            <td class="celdaTitulo">
                <asp:Label ID="Label1" runat="server" CssClass="labell" Text="Nombre"></asp:Label>
            </td>
            <td>&nbsp;
            </td>
            <td>&nbsp;
            </td>
            <td class="celdaTitulo">
                <asp:Label ID="Label2" runat="server" CssClass="labell" Text="Login"></asp:Label></td>
            <td>&nbsp;
            </td>
            <td>&nbsp;
            </td>
            <td class="celdaTitulo">
                <asp:Label ID="Label3" runat="server" CssClass="labell" Text="Correo"></asp:Label></td>
            <td>&nbsp;
            </td>
            <td>&nbsp;
            </td>
            <td class="celdaTitulo">
                <asp:Label ID="Label7" runat="server" CssClass="labell" Text="Rol"></asp:Label></td>
            <td>&nbsp;</td>
            <td>&nbsp;
            </td>
            <%--<td class="celdaTitulo">
                <asp:Label ID="Label6" runat="server" CssClass="labell" Text="Estatus"></asp:Label>
            </td>--%>
        </tr>
        <tr>
            <td>
                <asp:TextBox ID="txt_searchDisplayName" runat="server"></asp:TextBox>
            </td>
            <td>&nbsp;
            </td>
            <td>&nbsp;
            </td>
            <td>
                <asp:TextBox ID="txt_searchLogin" runat="server"></asp:TextBox>
            </td>
            <td>&nbsp;
            </td>
            <td>&nbsp;
            </td>
            <td>
                <asp:TextBox ID="txt_searchEMail" runat="server"></asp:TextBox>
            </td>
            <td>&nbsp;
            </td>
            <td>&nbsp;</td>
            <td>
                <div class="dropdown">
                    <asp:DropDownList ID="ddl_searchrol" runat="server">
                    </asp:DropDownList>
                </div>
            </td>
            <%--<td>&nbsp;</td>
            <td>&nbsp;
            </td>
            <td>
                <asp:DropDownList ID="ddl_searchStatus" runat="server">
                </asp:DropDownList>
            </td>--%>
        </tr>
    </table>
    <div class="search">
        <asp:ImageButton ID="btn_searchUser" runat="server" Alt="Buscar" CausesValidation="false" ImageUrl="~/images/Search44.png" />
    </div>

</div>


<div class="divContent">

    <div class="titulos2">Datos Generales</div>

    <div class="tablas">
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <div class="tabla1">
                    <table class="tablaDatosUsuario">
                        <tr>
                            <td class="vAlign">
                                <asp:Label ID="lbl_userLogin" runat="server" CssClass="labell" Text="UserName" Width="68px"></asp:Label>
                            </td>
                            <td style="text-align: left;">
                                <asp:TextBox ID="txt_userLogin" runat="server" ValidationGroup="g1" Width="149px" MaxLength="10"></asp:TextBox>                                
                                <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender8" runat="server" TargetControlID="txt_userLogin" 
                                    Enabled="True" ValidChars=" abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ0123456789áéíóúÁÉÍÓÚÜü">
                                </asp:FilteredTextBoxExtender>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="txt_userLogin"
                                                    Display="None" ErrorMessage="Campo Obligatorio!" ForeColor="Red" ValidationGroup="g1"/>
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender10" runat="server" CloseImageUrl="~/images/close.gif"
                                    CssClass="validatorCallout" HighlightCssClass="validatorCalloutHighlight"
                                    TargetControlID="RequiredFieldValidator9" WarningIconImageUrl="~/images/Warning.png" Enabled="True">
                                </asp:ValidatorCalloutExtender>

                                <asp:Label ID="lb_username" runat="server" Text="" Visible="false"></asp:Label>
                                <asp:RequiredFieldValidator ID="reqName" runat="server"
                                    ControlToValidate="txt_userLogin" Display="none"
                                    ErrorMessage="Campo Obligatorio!" ForeColor="red" ValidationGroup="g1" />
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender5" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="reqName" WarningIconImageUrl="~/images/Warning.png" />
                                <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" TargetControlID="txt_userlogin"
                                     FilterType="LowercaseLetters, UppercaseLetters, Numbers"></asp:FilteredTextBoxExtender>
                            </td>
                        </tr>
                        <tr>
                            <td class="vAlign">
                                <asp:Label ID="lbl_displayName" runat="server" CssClass="labell" Text="Nombre" Width="68px"></asp:Label>
                            </td>
                            <td style="width: 211px; text-align: left;">
                                <asp:TextBox ID="txt_nombre" runat="server" ValidationGroup="g1" Width="149px" MaxLength="100"></asp:TextBox>
                                <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="txt_nombre"
                                     FilterType="LowercaseLetters, UppercaseLetters"></asp:FilteredTextBoxExtender>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="txt_nombre" Display="none"
                                    ErrorMessage="Campo Obligatorio!" ForeColor="red" ValidationGroup="g1" />
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="RequiredFieldValidator1" WarningIconImageUrl="~/images/Warning.png" />
                            </td>
                        </tr>
                        <tr>
                            <td class="vAlign">
                                <asp:Label ID="lbl_userEmail" runat="server" CssClass="labell" Text="Email" Width="68px"></asp:Label>
                            </td>
                            <td style="width: 211px; text-align: left;">
                                <asp:TextBox ID="txt_email" runat="server" ValidationGroup="g1" Width="149px"></asp:TextBox>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Correo electrónico no Válido"
                                    Display="none" ValidationExpression="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b"
                                    ForeColor="Red" ControlToValidate="txt_email" ValidationGroup="g1" >
                                </asp:RegularExpressionValidator>
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender9" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="RegularExpressionValidator2" WarningIconImageUrl="~/images/Warning.png" />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="txt_email" Display="none"
                                    ErrorMessage="Campo Obligatorio!" ForeColor="red" ValidationGroup="g1" />
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="RequiredFieldValidator2" WarningIconImageUrl="~/images/Warning.png" />
                                <br />

                            </td>
                        </tr>
                        <tr>
                            <td class="vAlign">
                                <asp:Label ID="lbl_roles0" runat="server" CssClass="labell" Text="Contraseña" Width="68px"></asp:Label>
                            </td>
                            <td style="width: 211px; text-align: left; height: 23px;">
                                <asp:TextBox ID="txt_pass" runat="server" ValidationGroup="g1" Width="149px" TextMode="Password"></asp:TextBox>
                                <asp:PasswordStrength ID="PasswordStrength1" runat="server" TargetControlID="txt_pass" DisplayPosition="RightSide"
                                    StrengthIndicatorType="Text" PreferredPasswordLength="6" PrefixText="Fuerza: " RequiresUpperAndLowerCaseCharacters="false"
                                    TextStrengthDescriptions="Muy Pobre;Pobre;Promedio;Fuerte;Excelente" TextStrengthDescriptionStyles="muypobre;pobre;promedio;fuerte;excelente"
                                    TextCssClass="fondo">
                                </asp:PasswordStrength>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
                                    ControlToValidate="txt_pass" Display="none"
                                    ErrorMessage="Campo Obligatorio!" ForeColor="red" ValidationGroup="g1" />
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="RequiredFieldValidator3" WarningIconImageUrl="~/images/Warning.png" />


                                <br />
                                <asp:TextBox ID="txt_pass3" runat="server" Visible="false"
                                    Width="149px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="vAlign">
                                <asp:Label ID="lbl_roles1" runat="server" CssClass="labell" Text="Confirma Contraseña" Width="68px"></asp:Label>
                            </td>
                            <td style="width: 211px; text-align: left; height: 23px;">
                                <asp:TextBox ID="txt_pass2" runat="server" ValidationGroup="g1" Width="149px" TextMode="Password"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
                                    ControlToValidate="txt_pass2" Display="none"
                                    ErrorMessage="Campo Obligatorio!" ForeColor="red" ValidationGroup="g1" />
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender4" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="RequiredFieldValidator4" WarningIconImageUrl="~/images/Warning.png" />

                                <br />
                                <asp:TextBox ID="txt_pass4" runat="server" Visible="false"
                                    Width="149px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="vAlign">
                                <asp:Label ID="lbl_roles" runat="server" CssClass="labell" Text="Roles" Width="68px"></asp:Label>
                            </td>
                            <td style="width: 211px; text-align: left; height: 23px;">
                                <asp:DropDownList ID="ddl_rol" runat="server">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
                                    ControlToValidate="ddl_rol" Display="none" InitialValue="None"
                                    ErrorMessage="Campo Obligatorio!" ForeColor="red" ValidationGroup="g1" />
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="RequiredFieldValidator5" WarningIconImageUrl="~/images/Warning.png" />
                            </td>
                        </tr>
                        <%--<tr>
                            <td class="vAlign">
                                <asp:Label ID="lbl_status" runat="server" CssClass="labell" Text="Estatus" Width="68px"></asp:Label>
                            </td>
                            <td style="width: 211px; text-align: left;">
                                <asp:DropDownList ID="ddl_status" runat="server">
                                </asp:DropDownList>

                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
                                    ControlToValidate="ddl_status" Display="none" InitialValue="None"
                                    ErrorMessage="Campo Obligatorio!" ForeColor="red" ValidationGroup="g1" />
                                <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender7" runat="Server"
                                    CloseImageUrl="~/images/close.gif" CssClass="validatorCallout"
                                    HighlightCssClass="validatorCalloutHighlight" PopupPosition="Right"
                                    TargetControlID="RequiredFieldValidator6" WarningIconImageUrl="~/images/Warning.png" />

                            </td>
                        </tr>--%>
                    </table>
                    <asp:HiddenField ID="hf_Usuarios" runat="server" />
                    <table class="btnDatosUsuario">
                        <tr>
                            <td colspan="3" style="text-align: right">&nbsp;</td>
                        </tr>
                        <tr>
                            <td style="height: 26px">
                                <asp:Button ID="btn_insertUser" Alt="Registrar" runat="server" CssClass="button2" Text="Registrar" ValidationGroup="g1" />
                            </td>
                            <td style="height: 26px">
                                <asp:Button ID="btn_updateUser" runat="server" Alt="Actualizar" CssClass="button2" Text="Actualizar" Visible="false" ValidationGroup="g1" />
                            </td>
                            <td style="height: 26px">
                                <asp:Button ID="btn_cancel" runat="server" Alt="Cancelar" CssClass="button2" Text="Cancelar" CausesValidation="false" />
                            </td>
                        </tr>
                    </table>
                    <asp:Label ID="lb_error" runat="server"></asp:Label>
                </div>

                <div class="tabla2">
                    <asp:GridView ID="gv_users" runat="server" AutoGenerateColumns="False" AllowPaging="True" PageSize="5"
                        PagerStyle-CssClass="PagerColor" CssClass="Gridview" HeaderStyle-CssClass="HeaderFooterGridview" FooterStyle-CssClass="HeaderFooterGridview" CellPadding="5" GridLines="None" AlternatingRowStyle-CssClass="GridviewAlt">

                        <Columns>
                            <asp:TemplateField ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="editarUsuario"
                                        Text="Editar" CommandArgument='<%# Bind("usr_id") %>' OnClientClick="javascript:window.scrollTo(0,850);"></asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="eliminaUsuario"
                                        Text="Eliminar" CommandArgument='<%# Bind("usr_id") %>' OnClientClick="javascript:window.scrollTo(0,850);"></asp:LinkButton>
                                        <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="LinkButton2" 
                                    ConfirmText="¿Estas seguro de eliminar el registro?"></asp:ConfirmButtonExtender>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="usr_nombre" HeaderText="NOMBRE" />
                            <asp:BoundField DataField="usr_usuarios" HeaderText="USUARIO" />
                            <asp:BoundField DataField="rol_nombre" HeaderText="ROL" />
                            <%--<asp:BoundField DataField="stat_nombre" HeaderText="ESTATUS" />--%>
                        </Columns>
                    </asp:GridView>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btn_searchUser" EventName="Click" />
                <asp:AsyncPostBackTrigger ControlID="btn_insertUser" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</div>
